use datasource_connector::modeling_connector::SimpleMetaConnector;
use datasource_connector::restful::get_class;
use model_graph_types::builder::configure::ServerConfigureOption;
use model_graph_types::modeling::system_meta_database;
use tauri::{command, AppHandle, Runtime, State, Window};

use crate::handlers::ContextState;
use crate::handlers::Result;

use model_graph_types::{
    database::DatabaseType,
    modeling::{Class, MetaConnector},
};

#[command]
pub async fn builder_gserver_config<R: Runtime>(
    _app: AppHandle<R>,
    _window: Window<R>,
    state: State<'_, ContextState>,
    target: String,
    option: ServerConfigureOption,
) -> Result<i32> {
    //获取到数据源
    let context = state.context.clone();
    //查询
    let meta_datasource = system_meta_database()?;
    let instance =
        g01_builder::exporter::configure::export_server_config(&meta_datasource, &target, option)
            .await?;

    Ok(instance)
}
